package com.dwy2002.pojo.dto.courses;

import com.dwy2002.pojo.po.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 课程类DTO
 *
 * @author 杜伟毅
 * @version 1.0
 * @since 2025/01/20
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class CoursesDTO extends BaseEntity {
    /**
     * 课程标题
     */
    private String title;

    /**
     * 课程描述
     */
    private String description;

    /**
     * 课程封面图片URL
     */
    private String image;

    /**
     * 课程费用
     */
    private BigDecimal fee;

    /**
     * 课程开始时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", shape = JsonFormat.Shape.STRING)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)        // 反序列化
    @JsonSerialize(using = LocalDateTimeSerializer.class)        // 序列化
    private LocalDateTime startTime;

    /**
     * 课程状态，默认为0，0=未开始, 1=已开始, 2=已结束, 3=已取消
     */
    private Integer status;
    /**
     * 报名限制人数，-1代表无限人数
     */
    private Integer peopleLimit;
    /**
     * 接收图片链接
     */
    private List<CourseImagesDTO> courseImages;
}
